package svc

import (
	"fmt"
	"github.com/zeromicro/go-zero/core/stores/redis"
	"time"
	"web_server/internal/config"
)

func ConnectRedis(c config.Redis) *redis.Redis {
	return redis.MustNewRedis(redis.RedisConf{
		Host:        fmt.Sprintf("%s:%d", c.Host, c.Port),
		Type:        "node",
		Pass:        c.Password,
		Tls:         false,
		PingTimeout: 3 * time.Second,
	})
}
